package com.imooc.demo.thread;

public class Stage2 extends Thread{

    @Override
    public void run() {

        ArmyRunnable armyTaskOfSuiDynasty = new ArmyRunnable();
        //ArmyRunnable armyTaskOfRevolt = new ArmyRunnable();

        //TODO 1
        Thread armyOfSuiDynasty = new Thread(armyTaskOfSuiDynasty,"隋军");
        Thread armyOfRevolt = new Thread(armyTaskOfSuiDynasty,"农民起义军");

        armyOfSuiDynasty.start();
        armyOfRevolt.start();

        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        armyTaskOfSuiDynasty.keepRunning = false;
        //armyTaskOfSuiDynasty.keepRunning = false;

        try {
            armyOfRevolt.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new Stage2().start();
    }
}
